<!doctype html>
<html lang="en">

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Template • TodoMVC</title>
	<link rel="stylesheet" href="node_modules/todomvc-common/base.css">
	<link rel="stylesheet" href="node_modules/todomvc-app-css/index.css">
	<!-- CSS overrides - remove if you don't need it -->
	<link rel="stylesheet" href="css/app.css">
</head>

<body>
	<!-- 挂载对象 -->
	<section class="todoapp" id="app" v-cloak>
		<!-- 输入框区域 -->
		<header class="header">
			<h1>todos</h1>
			<!-- 事项新增 
				7.内容检测通过绑定v-model确定输入框内容
				8.触发键盘的enter键事件,添加内容到事项列表
			-->
			<input class="new-todo" placeholder="What needs to be done?" autofocus v-model="newTodo" @keyup.enter='addTodo()'>
		</header>
		<!-- 事项列表区域 -->
		<section class="main">
			<!-- 6.多个事项切换 getChange-->
			<input id="toggle-all" class="toggle-all" type="checkbox" v-model="getChange">
			<label for="toggle-all">Mark all as complete</label>
			<ul class="todo-list">
				<!-- 事项的每一项li  1.解决有事项情况下的数据渲染-->
				<li v-for="item in filteredTodo" :class="{completed:item.completed,editing:item === editTodo}">
					<div class="view">
						<!-- 复选框的取消与选中 5.单个事项切换,绑定v-model-->
						<input class="toggle" type="checkbox" v-model="item.completed">
						<!-- 双击事项,11.触发编辑框(存储当前的item(editTodo)及item.title(titleBefore)值) -->
						<label @dblclick='getEdit(item)'>{{item.title}}</label>
						<!-- 事项删除 9.单个事项删除removeTodo(item -->
						<button class="destroy" @click="removeTodo(item)"></button>
					</div>
					<!-- 编辑输入框 
						12.取消编辑 (恢复原来数据,并且编辑框隐藏)
						13.保存编辑(修改原始的titleBefore数据及取消正在的编辑框)editSave
					-->
					<input class="edit" v-model="item.title" v-focus="item === editTodo" @keyup.enter="editSave(item)"
						@blur="editSave(item)" @keyup.esc="editCancle(item)">
				</li>
			</ul>
		</section>
		<!-- 状态栏显示区域  2.在没有事项的情况下(todos.length===0)该区域应该隐藏-->
		<footer class="footer" v-show="todos.length">
			<!-- 未完成的任务数量 3.个数展示getCount  4.单位处理getPlural-->
			<span class="todo-count"><strong>{{getCount}}</strong> {{getPlural('item')}} left</span>
			<!-- 点击切换状态 -->
			<ul class="filters">
				<li>
					<a :class="{selected:todoType==='all'}" href="javascript:;" @click="todoType='all'">All</a>
				</li>
				<li>
					<a :class="{selected:todoType==='active'}" href="javascript:;" @click="todoType='active'">Active</a>
				</li>
				<li>
					<a :class="{selected:todoType==='completed'}" href="javascript:;" @click="todoType='completed'">Completed</a>
				</li>
			</ul>
			<!-- 10.已完成事项删除 removeCompleted-->
			<button class="clear-completed" @click="removeCompleted()">Clear completed</button>
		</footer>
	</section>
	<footer class="info">
		<p>Double-click to edit a todo</p>
		<!-- Remove the below line ↓ -->
		<p>Template by <a href="http://sindresorhus.com">Sindre Sorhus</a></p>
		<!-- Change this out with your name and url ↓ -->
		<p>Created by <a href="http://todomvc.com">you</a></p>
		<p>Part of <a href="http://todomvc.com">TodoMVC</a></p>
	</footer>
	<!-- Scripts here. Don't remove ↓ -->
	<script src="node_modules/todomvc-common/base.js"></script>
	<script src="node_modules/vue/dist/vue.js"></script>
	<script src="js/app.js"></script>
</body>

</html>